/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.musiqueFaces.model;

/**
 *
 * @author Jissay
 */
public class Artist {

    private String lastname;
    private String firstname;
    private int id;
    private String login;
    private String password;


    /* CONSTRUCTORS */

    public Artist(String lastname, String firstname) {
        this.lastname = lastname;
        this.firstname = firstname;
        this.computeLoginAndPassword();
        this.id = -1;
    }

    public Artist(String lastname, String firstname, String login, String password) {
        this.lastname = lastname;
        this.firstname = firstname;
        this.login = login;
        this.password = password;
        this.id = -1;
    }

    public Artist(String lastname, String firstname, String login, String password, int id) {
        this.lastname = lastname;
        this.firstname = firstname;
        this.login = login;
        this.password = password;
        this.id = id;
    }


    /* OPERATIONS */

    public void computeLoginAndPassword() {
        this.login = lastname.toLowerCase() + "." + firstname.substring(0, 1).toLowerCase();
        this.password = lastname.substring(0,1).toLowerCase() + firstname.substring(0, 1).toLowerCase() + "123";
    }

    @Override
    public String toString() {
        return this.id + " - " + this.firstname + " " + this.lastname;
    }


    /* GETTERS AND SETTERS */

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
